#到库
import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.globals import ThemeType
#读取表格
df=pd.read_excel('某店铺促销方式分析.xlsx ')
#创建画布
pie=Pie(init_opts=opts.InitOpts(width='1050px',
                                height='400px',
                                theme=ThemeType.LIGHT,
                                page_title='环形图'))

#添加数据
pie.add(series_name='',
        data_pair=df[['促销方式','男']].values.tolist(),
        radius=120,center=['25%','55%'],
        label_opts=opts.LabelOpts(formatter='{b}({d}%)'))
pie.add(series_name='',
        data_pair=df[['促销方式','女']].values.tolist(),
        radius=[80,120],center=['70%','55%'],
        label_opts=opts.LabelOpts(formatter='{b}({d}%)'))
#设置全局
pie.set_global_opts(title_opts=opts.TitleOpts(
    title='',pos_left='center'),
    legend_opts=opts.LegendOpts(is_show=False)
)
pie.render('666.html')